﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="WebMainSite.MainPage" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Register Src="~/HeadControl.ascx" TagName="HeadControl" TagPrefix="uc1" %>
<%@ Register Src="~/CoypyrightControl.ascx" TagName="CoypyrightControl" TagPrefix="uc2"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>密钥管理</title>
    <meta name="description" content="Administry - Admin Template by Zoran Juric" />
    <meta name="keywords" content="Admin,Template" />
    <!-- Favicons -->
    <link rel="shortcut icon" type="image/png" href="img/favicons/favicon.png" />
    <link rel="icon" type="image/png" href="img/favicons/favicon.png" />
    <link rel="apple-touch-icon" href="img/favicons/apple.png" />
    <!-- Main Stylesheet -->
    <link rel="stylesheet" href="css/style.css" type="text/css" />
    <!-- Colour Schemes
Default colour scheme is blue. Uncomment prefered stylesheet to use it.
<link rel="stylesheet" href="css/brown.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/gray.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/green.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/pink.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/red.css" type="text/css" media="screen" />
-->
    <!-- Your Custom Stylesheet -->
    <link rel="stylesheet" href="css/custom.css" type="text/css" />
    <!--swfobject - needed only if you require <video> tag support for older browsers -->
    <script type="text/javascript" src="js/swfobject.js"></script>
    <!-- jQuery with plugins -->
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <!-- Could be loaded remotely from Google CDN : <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> -->
    <script type="text/javascript" src="js/jquery.ui.core.min.js"></script>
    <script type="text/javascript" src="js/jquery.ui.widget.min.js"></script>
    <script type="text/javascript" src="js/jquery.ui.tabs.min.js"></script>
    <!-- jQuery tooltips -->
    <script type="text/javascript" src="js/jquery.tipTip.min.js"></script>
    <!-- Superfish navigation -->
    <script type="text/javascript" src="js/jquery.superfish.min.js"></script>
    <script type="text/javascript" src="js/jquery.supersubs.min.js"></script>
    <!-- jQuery form validation -->
    <script type="text/javascript" src="js/jquery.validate_pack.js"></script>
    <!-- jQuery popup box -->
    <script type="text/javascript" src="js/jquery.nyroModal.pack.js"></script>
    <!-- jQuery data tables -->
    <script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
    <!-- Internet Explorer Fixes -->
    <!--[if IE]>
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/>
<script src="js/html5.js"></script>
<![endif]-->
    <!--Upgrade MSIE5.5-7 to be compatible with MSIE8: http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js -->
    <!--[if lt IE 8]>
<script src="js/IE8.js"></script>
<![endif]-->
    <script type="text/javascript">
        $(document).ready(function () {

            /* setup navigation, content boxes, etc... */
            Administry.setup();

            /* datatable */
            $('#example').dataTable();

            /* expandable rows */
            Administry.expandableRows();
        });

    </script>
    <script type="text/javascript" language="javascript">
        function getLen(str) {
            return str.replace(/[^\x00-\xff]/g, "aa").length; //把汉字替换成两个英文字母来计算长度
        }
        function validataInput() {
            if (getLen(document.getElementById("yufenpei").value) > 30) {
                alert("预分配的企业名字太长，请重新输入");
                return false;
            }
            else
                return true;
        }

        function inputNumLent() {
            if (document.getElementById("num").value.length > 4) {
                alert("输入的数字太大了！")
                return false;
            }
            else {
                return true;
            }
        }
    </script>
</head>
<body>
    <form runat="server">
    <!-- Header -->
    <div>
    <uc1:HeadControl ID="HeadControl1" runat="server" />
    </div>
    <!-- End of Header -->
    <!-- Page title -->
    <div id="pagetitle">
        <div class="wrapper">
            <h1>密钥管理</h1>
        </div>
    </div>
    <!-- End of Page title -->
    <!-- Page content -->
    <div id="page">
        <!-- Wrapper -->
        <div class="wrapper">
            <!-- Left column/section -->
            <section class="column width8 first">										
					<div class="box box-info">生成 密钥-企业ID</div>
                    <div>
                    <p>
						<label class="required" for="num">生成个数(最大9999):</label>
						<input type="text" id="num" runat="server" class="half" style="width:100px" value="" name="num" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
                        <asp:Button ID="BtCreateKey" Text="生成" runat="server" class="btn btn-blue" 
                            onclick="BtCreateKey_Click" OnClientClick="return inputNumLent()"/>
					</p>
                    <p>
                    <asp:Literal ID="LbMessage" runat="server"></asp:Literal>
                    </p>
                    </div>                									
					<div class="clear">&nbsp;</div>
                    <div id="EditDiv" runat="server">
                        <div class="box box-info">修改分配 密钥-企业ID</div>
                        <div>
                        <fieldset>
							<legend>修改</legend>
                            <p>
                            <label class="required" for="miyue">密钥：</label><br/>
						    <input type="text" id="miyue" runat="server" class="half" readonly="readonly" value="" name="miyue"/>
                            </p>
                            <p>
                            <label class="required" for="qiyeid">企业ID：</label><br/>
						    <input type="text" id="qiyeid" runat="server" class="half" readonly="readonly" value="" name="qiyeid"/>
                            </p>
                            <p>
                            <label class="required" for="yufenpei">预分配给：</label><br/>
						    <input type="text" id="yufenpei" runat="server" class="half" value="" name="yufenpei"/>
                            </p>
                            <p>
                            <label class="required" for="shijishiyong">实际使用该密钥的企业：</label><br/>
						    <input type="text" id="shijishiyong" runat="server" class="half" readonly="readonly" value="" name="shijishiyong"/>
                            </p>
                            <p>
                            <asp:Label ID="LbChangeMessage" runat="server" Text=""></asp:Label>
                            </p>
                            <p>
                            <asp:Button ID="BtChange" runat="server" Text="修改" class="btn btn-blue" 
                                    onclick="BtChange_Click" OnClientClick="return validataInput()"></asp:Button>
                            </p>
                        </fieldset>
                        </div>
                    </div>
                    <div class="clear">&nbsp;</div>
                    <div class="box box-info">所有 密钥-企业ID</div>
                    <div>
                    <asp:GridView ID="GridView1" runat="server" CellPadding="4"  CssClass="stylized full"
                            GridLines="None" AllowPaging="True"
                            AutoGenerateColumns="False" onpageindexchanging="GridView1_PageIndexChanging" 
                            PageSize="15" 
                            onrowdatabound="GridView1_RowDataBound" onrowdeleting="GridView1_RowDeleting" 
                            onselectedindexchanging="GridView1_SelectedIndexChanging">
                        <AlternatingRowStyle BackColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <EmptyDataTemplate>
                            暂无数据
                        </EmptyDataTemplate>
                        <Columns>
                        <asp:BoundField DataField="SecretKey" HeaderText="密钥" >
                            <ItemStyle Width="400px" />
                            </asp:BoundField>
                        <asp:BoundField DataField="EnterpriserID" HeaderText="企业代号">
                            <ItemStyle HorizontalAlign="Left" Width="100px" />
                            </asp:BoundField>
                        <asp:BoundField DataField="AssignTo" HeaderText="预分配给" >
                            <ItemStyle HorizontalAlign="Left" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="DeptName" HeaderText="实际使用企业">
                            <ItemStyle HorizontalAlign="Left" Height="20px"
                                Width="200px" />
                            </asp:BoundField>
                            <asp:CommandField SelectText="修改" ShowSelectButton="True" >
                            <ItemStyle HorizontalAlign="Left" Width="100px" />
                            </asp:CommandField>
                            <asp:CommandField ShowDeleteButton="True" >
                            <ItemStyle  HorizontalAlign="Left" Width="50px" />
                            </asp:CommandField>
                        </Columns>
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Left"/>
                        <RowStyle BackColor="#EFF3FB" />
                        </asp:GridView>
                        </div>								
					<div>&nbsp;</div>
					
				</section>
        </div>
        <!-- End of Wrapper -->
    </div>
    <!-- End of Page content -->
    <!-- Page footer -->
    <div>
        <uc2:CoypyrightControl ID="CoypyrightControl1" runat="server" />
    </div>
    <!--End Page footer -->
    <!-- User interface javascript load -->
    <script type="text/javascript" src="js/administry.js"></script>
    </form>
</body>
</html>
